package com.csmp.action;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;

import com.bs.bean.Dict;
import com.bs.bean.Optr;
import com.dj.conn.DataBean;
import com.opensymphony.xwork2.ActionSupport;


public class CommonAction extends ActionSupport  {
	
	public final static Log logger = LogFactory.getLog(CommonAction.class.getName());
	private List dataList;
	private CommonPage pager = new CommonPage();
	
	private List<Dict> ksList=new ArrayList<Dict>();
	
	private List<Dict> xmList =new ArrayList<Dict>();

	public List getDataList() {
		
		return dataList;
	}

	public void setDataList(List dataList) {
		this.dataList = dataList;
	}

	public HttpServletRequest getHttpRequest() {
		return  ServletActionContext.getRequest();
	}

	public HttpServletResponse getHttpResponse() {
		return  ServletActionContext.getResponse();
	}

	public CommonPage getPager() {
		return pager;
	}

	public void setPager(CommonPage pager) {
		this.pager = pager;
	}

	
  protected void initXl(Long userId){
	  DataBean db=new DataBean();
		ResultSet rs = null;
		//ResultSet rs2 = null;
		rs=db.executeQuery(" select code, name from Dept where  valid='1'");
		
		
		try {
			while(rs.next()){
				Dict d=new Dict();
				d.setCode(rs.getString("code"));
				d.setName(rs.getString("name"));
				ksList.add(d);
			}
			/*rs2=db.executeQuery(" select name from project where create_optr_id="+userId);
			while(rs2.next()){
				Dict d1=new Dict();
				d1.setCode(rs2.getString("name"));
				d1.setName(rs2.getString("name"));
				xmList.add(d1);
			}*/
			rs.close();
			//rs2.close();
			db.close();
			
		} catch (SQLException e) {
			e.printStackTrace();
		}
  }

public List<Dict> getKsList() {
	return ksList;
}

public void setKsList(List<Dict> ksList) {
	this.ksList = ksList;
}

public List<Dict> getXmList() {
	return xmList;
}

public void setXmList(List<Dict> xmList) {
	this.xmList = xmList;
}


}